package com.bookstore.Domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 未来
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("订单实体类")
public class Shopping {

    @TableId(type = IdType.AUTO)
    private int id;
    @ApiModelProperty("书籍名")
    private String name;
    @ApiModelProperty("书籍图片")
    private String image;
    @ApiModelProperty("用户ID")
    private int userId;
    @ApiModelProperty("书籍ID")
    private int bookId;
    @ApiModelProperty("书籍类型")
    private int bookCategory;
    @ApiModelProperty("购买数量")
    private int number;
    @ApiModelProperty("商品单价")
    private  double amount;

    /**
     * 设置自动填充：sql语句
     */
    @TableField(fill = FieldFill.INSERT)
    private Date gmt_create;

    /**
     * 修改时间：修改数据的时候,看得到，映射不会生效***
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmt_modified;

    /**
     * 逻辑删除： UPDATE user SET deleted=1 WHERE name = ? AND deleted=0
     * 查询的时候会自动过滤删除过的字段***
     */
    @TableLogic
    private Integer deleted;
}
